home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Harvest C 1.3 / Application / Examples / Harvest Bullseye / bullWindow.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-05  |  987 b   |  60 lines  |  [TEXT/KAHL]

  1. /*****
  2.  * bullWindow.c
  3.  *
  4.  *        The window routines for the Bullseye demo
  5.  *
  6.  *****/
  7.  
  8. #include <Windows.h>
  9.  
  10. #include "bullWindow.h"
  11.  
  12. WindowPtr    bullseyeWindow;
  13. Rect        dragRect;
  14. Rect        windowBounds = { 40, 40, 150, 150 };
  15. Rect        circleStart = {10, 10, 100, 100};
  16. int            width = 5;
  17.  
  18. /****
  19.  * SetUpWindow()
  20.  *
  21.  *    Create the Bullseye window, and open it.
  22.  *
  23.  ****/
  24.  
  25. void SetUpWindow(void)
  26.  
  27. {
  28.     dragRect = qd.screenBits.bounds;
  29.     
  30.     bullseyeWindow = NewWindow(0L, &windowBounds, "\pBullseye", true, noGrowDocProc, (WindowPtr) -1L, true, 0);
  31.     SetPort(bullseyeWindow);
  32. }
  33. /* end SetUpWindow */
  34.  
  35.  
  36. /*****
  37.  * DrawBullseye()
  38.  *
  39.  *    Draws the bullseye.
  40.  *
  41.  *****/
  42.  
  43. void DrawBullseye(short active)
  44.  
  45. {
  46.     Rect    myRect;
  47.     int        color = true;
  48.     
  49.     SetPort(bullseyeWindow);
  50.     EraseRect(&circleStart);
  51.     myRect = circleStart;
  52.     
  53.     while(myRect.left < myRect.right)
  54.       {
  55.       FillOval(&myRect, color ? (active ? qd.black : qd.gray) : qd.white);
  56.       InsetRect(&myRect, width, width);
  57.       color = !color;
  58.       } 
  59. }
  60. /* end DrawBullseye */